package com.aaa.ssm.controller;

import com.aaa.ssm.entity.Help;
import com.aaa.ssm.entity.Theme;
import com.aaa.ssm.service.HelpServer;
import com.aaa.ssm.util.Page;
import com.aaa.ssm.util.Result;
import org.apache.ibatis.annotations.Delete;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("help")
public class HelpController extends BaseController {
    @Resource  //依赖注入
    private HelpServer helpServer;

    /**
     * post  分页带参查询
     * @param page
     * @return
     */
    @PostMapping("queryPage")
    public Result queryPage(@RequestBody Page<Help> page){
        return success(helpServer.queryAll(page));
    }

    /**
     * post 添加
     * @param theme
     * @return
     */
    @PostMapping("add")
    public Result add(@RequestBody Help theme){
        return success(helpServer.add(theme));
    }

    /**
     *  post 更新
     * @param theme
     * @return
     */
    @PostMapping("update")
    public Result update(@RequestBody Help theme){
        return  success(helpServer.update(theme));
    }

    /**
     * delete 根据编号删除
     * @param id
     * @return
     */
    @DeleteMapping("delete/{id}")
    public Result deleteById(@PathVariable("id")String id){
        return  success(helpServer.delete(id));
    }
}
